/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ChArFaTo
 */
@Entity
@Table(name = "salario_sparafiscales", catalog = "proyectosw", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SalarioSparafiscalesEJB.findAll", query = "SELECT s FROM SalarioSparafiscalesEJB s"),
    @NamedQuery(name = "SalarioSparafiscalesEJB.findBySalarioSCodigo", query = "SELECT s FROM SalarioSparafiscalesEJB s WHERE s.salarioSparafiscalesEJBPK.salarioSCodigo = :salarioSCodigo"),
    @NamedQuery(name = "SalarioSparafiscalesEJB.findBySalarioIndex", query = "SELECT s FROM SalarioSparafiscalesEJB s WHERE s.salarioSparafiscalesEJBPK.salarioIndex = :salarioIndex"),
    @NamedQuery(name = "SalarioSparafiscalesEJB.findBySParafiscales", query = "SELECT s FROM SalarioSparafiscalesEJB s WHERE s.sParafiscales = :sParafiscales")})
public class SalarioSparafiscalesEJB implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SalarioSparafiscalesEJBPK salarioSparafiscalesEJBPK;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private double sParafiscales;
    @JoinColumn(name = "SalarioSCodigo", referencedColumnName = "SCodigo", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private SalarioEJB salarioEJB;

    public SalarioSparafiscalesEJB() {
    }

    public SalarioSparafiscalesEJB(SalarioSparafiscalesEJBPK salarioSparafiscalesEJBPK) {
        this.salarioSparafiscalesEJBPK = salarioSparafiscalesEJBPK;
    }

    public SalarioSparafiscalesEJB(SalarioSparafiscalesEJBPK salarioSparafiscalesEJBPK, double sParafiscales) {
        this.salarioSparafiscalesEJBPK = salarioSparafiscalesEJBPK;
        this.sParafiscales = sParafiscales;
    }

    public SalarioSparafiscalesEJB(int salarioSCodigo, int salarioIndex) {
        this.salarioSparafiscalesEJBPK = new SalarioSparafiscalesEJBPK(salarioSCodigo, salarioIndex);
    }

    public SalarioSparafiscalesEJBPK getSalarioSparafiscalesEJBPK() {
        return salarioSparafiscalesEJBPK;
    }

    public void setSalarioSparafiscalesEJBPK(SalarioSparafiscalesEJBPK salarioSparafiscalesEJBPK) {
        this.salarioSparafiscalesEJBPK = salarioSparafiscalesEJBPK;
    }

    public double getSParafiscales() {
        return sParafiscales;
    }

    public void setSParafiscales(double sParafiscales) {
        this.sParafiscales = sParafiscales;
    }

    public SalarioEJB getSalarioEJB() {
        return salarioEJB;
    }

    public void setSalarioEJB(SalarioEJB salarioEJB) {
        this.salarioEJB = salarioEJB;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (salarioSparafiscalesEJBPK != null ? salarioSparafiscalesEJBPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalarioSparafiscalesEJB)) {
            return false;
        }
        SalarioSparafiscalesEJB other = (SalarioSparafiscalesEJB) object;
        if ((this.salarioSparafiscalesEJBPK == null && other.salarioSparafiscalesEJBPK != null) || (this.salarioSparafiscalesEJBPK != null && !this.salarioSparafiscalesEJBPK.equals(other.salarioSparafiscalesEJBPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Modelo.SalarioSparafiscalesEJB[ salarioSparafiscalesEJBPK=" + salarioSparafiscalesEJBPK + " ]";
    }
    
}
